home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / CoreGateway / StatusDatabase.cp < prev    next >
Encoding:
Text File  |  1995-07-28  |  2.9 KB  |  119 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        StatusDatabase.cp
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __STATUSDATABASE__
  15. #include "StatusDatabase.h"
  16. #endif
  17.  
  18. #ifndef    __DEBUGASSERT__
  19. #include "DebugAssert.h"
  20. #endif
  21.  
  22. #if 0
  23.  
  24. /***********************************|****************************************/
  25.  
  26. LogStatusType gLogStatus;
  27.  
  28. /***********************************|****************************************/
  29.  
  30. #pragma segment Initialize
  31. void InitStatusDatabase(LogStatusType logStatus)
  32. {
  33.     gLogStatus = logStatus;
  34.  
  35.     gStatusDatabase = new TRamTupleDatabase;
  36.  
  37.     ASSERT_RETURN ( gStatusDatabase != nil );
  38.  
  39.     unsigned long startUpTime;
  40.  
  41.     GetDateTime(&startUpTime);
  42.     SetLongStatus(kGatewayStartupTime,startUpTime);
  43.     SetLongStatus(kGatewayTime,startUpTime);
  44.  
  45.     SetStringStatus(kGatewayName,"Bovine Gateway #1");
  46.     SetLongStatus(kTotalLetters,0);
  47.  
  48.     SetLongStatus(kLettersQueuedToBeReceivedby2020,0);
  49.     SetLongStatus(kLettersSubmittedto2020,0);
  50.     SetLongStatus(kTotalLettersSentFrom2020,0);
  51.     SetLongStatus(kTotalLettersSentFromConnector,0);
  52.     SetLongStatus(kTotalLettersBundled,0);
  53.     SetLongStatus(kBundlesQueuedToBeSent,0);
  54.     SetLongStatus(kBundlesQueuedFromConnector,0);
  55.  
  56.     SetLongStatus(kTotalContentProcessed,0);
  57.     SetLongStatus(kAvailableDiskSpace,0);
  58.     SetLongStatus(kTotalEnclosuresProcessed,0);
  59. }
  60.  
  61. /***********************************|****************************************/
  62.  
  63. Boolean GetLongStatus ( long tupleID, long& theData )
  64. {
  65.     CWrapperBuffer data ( &theData, sizeof ( theData ) );
  66.     return gStatusDatabase->GetTupleData ( CFourByteKey ( tupleID ), data );
  67. }
  68.  
  69. /***********************************|****************************************/
  70.  
  71. void SetLongStatus ( long tupleID, long theData )
  72. {
  73.     CWrapperBuffer data ( &theData, sizeof ( theData ) );
  74.     gStatusDatabase->SetTuple ( CFourByteKey ( tupleID ), data );
  75. }
  76.  
  77. /***********************************|****************************************/
  78.  
  79. void DecrementLongStatus ( long tupleID )
  80. {
  81.     long theData;
  82.  
  83.     if ( GetLongStatus ( tupleID, theData ) )
  84.         SetLongStatus ( tupleID, theData - 1 );
  85.     else
  86.         SetLongStatus ( tupleID, -1 );
  87. }
  88.  
  89. /***********************************|****************************************/
  90.  
  91. void IncrementLongStatus ( long tupleID )
  92. {
  93.     long theData;
  94.  
  95.     if ( GetLongStatus ( tupleID, theData ) )
  96.         SetLongStatus ( tupleID, theData + 1 );
  97.     else
  98.         SetLongStatus ( tupleID, 1 );
  99. }
  100.  
  101. /***********************************|****************************************/
  102.  
  103. void SetStringStatus ( long tupleID, char* theString )
  104. {
  105.     gStatusDatabase->SetTuple ( CFourByteKey ( tupleID ), CWrapperBuffer ( theString, strlen ( theString ) ) );
  106. }
  107.  
  108. /***********************************|****************************************/
  109.  
  110. void SetLogString(long tupleID, char* theMsg)
  111. {
  112.     if (gLogStatus != nil)
  113.         (gLogStatus)(tupleID,theMsg);
  114. }
  115.  
  116. /***********************************|****************************************/
  117.  
  118. #endif
  119.